package com.lc.qianrenshiye;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.lc.qianrenshiye.activity.GuideActivity;
import com.lc.qianrenshiye.activity.HomeActivity;
import com.lc.qianrenshiye.activity.LoginActivity;
import com.zcx.helper.app.AppApplication;

public class WelcomeActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);

        BaseApplication.INSTANCE.setInitSuccessCallBack(new AppApplication.OnInitSuccessCallBack() {

            @Override
            public void onInitSuccess() {

                new Handler() {

                    @Override
                    public void handleMessage(Message msg) {

                        if (!BaseApplication.BasePreferences.readIsLogin()) {

                            startVerifyActivity(BaseApplication.BasePreferences.readIsGuide() ? LoginActivity.class : GuideActivity.class);

                            finish();

                        } else {

                            startActivity(new Intent(WelcomeActivity.this, HomeActivity.class));

                            finish();

                        }



                    }

                }.sendEmptyMessageDelayed(0, 3000);

            }

        });

    }
}
